<html>
<head><meta charset="utf-8"><title>Structured Logging and One-Off Errors · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html">Structured Logging and One-Off Errors</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="212183775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212183775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leonora Tindall <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212183775">(Oct 03 2020 at 18:22)</a>:</h4>
<p>Hi all!</p>
<p>My employer CancerIQ currently uses Rust for all of our logic related to cancer risk assessment and clinical decision support. <span class="user-mention" data-user-id="220273">@Jane Lusby</span>, your talk really inspired me to rethink the error handling story there, which I hugely appreciate. We're slowly moving from <code>panic!</code> everywhere and a global unwind catcher to <code>anyhow</code> and <code>thiserror</code>-based error types.</p>
<p>This is really great, obviously a huge improvement over the hacky system we were using before, but we still don't have a very good story around structured logging, which is really important for our other services. Right now, our Rust code is the only code that doesn't give out nicely formatted JSON logs. This is partly because our largest and most important service is using Iron 0.6, which has a rather poor logging and monitoring story, and partly because there's just not great support for structured logging in the logging ecosystem in general.</p>
<p>These are all problems we can solve, especially in that once Rocket 0.5 lands we will be able to move from Iron to Rocket (management doesn't like the risks involved with using a nightly Rust compiler for a production CDS service), and Rocket will have much more extensible logging. This just leaves us with the issue of how to get structured error data up to the level where it can be logged and returned with sufficient context.</p>
<p>With <code>anyhow</code> and <code>thiserror</code>, we generally define commonly-used error types with <code>thiserror</code>, such as errors that occur in our family graph logic and are common to many different pieces of logic. We then use the <code>anyhow::Result</code> type as the return type for the vast majority of functions and use <code>.with_context</code> to add context at each level. This leads to really well contextualized errors, and I can see my way towards implementing a semi-structured logging method using <code>anyhow::Error::chain</code>, but what I really want is a way to put in arbitrary key-value pairs along with a message and reconstitute them in a hierarchy at the top level. Obviously this is not a real API, but I'm thinking of something like:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">foobar</span><span class="p">.</span><span class="n">frobnicate</span><span class="p">(</span><span class="n">baz</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">.</span><span class="n">with_context</span><span class="p">(</span><span class="o">||</span><span class="w"> </span><span class="n">error_vals</span><span class="o">!</span><span class="p">(</span><span class="s">"the foobar failed to frobnicate the baz"</span><span class="p">,</span><span class="w"> </span><span class="n">foobar_version</span>: <span class="nc">foobar</span><span class="p">.</span><span class="n">version</span><span class="p">,</span><span class="w"> </span><span class="n">baz_size</span>: <span class="nc">baz</span><span class="p">.</span><span class="n">capacity</span><span class="p">())</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
</code></pre></div>

<p>Which I could then reconstitute into a JSON object like this:</p>
<div class="codehilite" data-code-language="JSON"><pre><span></span><code><span class="p">{</span>
    <span class="nt">"message"</span><span class="p">:</span> <span class="s2">"the foobar failed to frobnicate the baz"</span><span class="p">,</span>
    <span class="nt">"foobar_version"</span><span class="p">:</span> <span class="s2">"2.3.2"</span><span class="p">,</span>
    <span class="nt">"baz_size"</span><span class="p">:</span> <span class="mi">32</span><span class="p">,</span>
    <span class="nt">"cause"</span><span class="p">:</span> <span class="p">{</span>
        <span class="nt">"message"</span><span class="p">:</span> <span class="s2">"foobar cache was inconsistent"</span><span class="p">,</span>
        <span class="nt">"cache_size"</span><span class="p">:</span> <span class="mi">93120</span><span class="p">,</span>
        <span class="err">//</span> <span class="err">...</span> <span class="err">more</span> <span class="err">stuff</span>
    <span class="p">}</span>
<span class="p">}</span>
</code></pre></div>

<p>As I'm working in a non-embedded, memory-wide use case, I'm happy to allocate to do this; even just having a vector of tuples would be fine. My basic question is, is the direction things are moving likely to result in something that would support this as a possibility? Does this sound like a use case others are describing? If I were to build something like this for CancerIQ, would the error handling group be interested in that work?</p>
<p>Thanks a ton!</p>



<a name="212184274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184274">(Oct 03 2020 at 18:34)</a>:</h4>
<p>I think the generic member access RFC could in theory support this</p>



<a name="212184285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184285">(Oct 03 2020 at 18:34)</a>:</h4>
<p>you'd have a trait that does your structured logging, maybe serde Serialize</p>



<a name="212184289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184289">(Oct 03 2020 at 18:35)</a>:</h4>
<p>and you'd use the generic member access to upcast your errors from &amp;dyn Error to &amp;dyn Serialize</p>



<a name="212184297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leonora Tindall <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184297">(Oct 03 2020 at 18:35)</a>:</h4>
<p>Is that <a href="https://github.com/rust-lang/rfcs/pull/2895">2895</a>?</p>



<a name="212184302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184302">(Oct 03 2020 at 18:35)</a>:</h4>
<p>you'd likely need to write your own contextualizing trait methods to replace with_context so you can create these dynamically rather than on a per error type basis</p>



<a name="212184321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184321">(Oct 03 2020 at 18:35)</a>:</h4>
<p>that's the one</p>



<a name="212184471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leonora Tindall <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184471">(Oct 03 2020 at 18:39)</a>:</h4>
<p>Okay, that makes sense! I definitely think that RFC would make this a great deal easier. I'm going to try to build a proof of concept at some point this weekend or next week and I'll share that here if that would be useful. Thanks a ton.</p>



<a name="212184708"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184708" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184708">(Oct 03 2020 at 18:45)</a>:</h4>
<p><span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span>️</p>



<a name="212184887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212184887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dan Johnson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212184887">(Oct 03 2020 at 18:50)</a>:</h4>
<p>I was wondering if you could emulate that by inserting fake entries in the source chain and using downcast to find them again. But it looks like there's no way to get anyhow to skip printing the fake entries when it's printing the source chain</p>



<a name="212185303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185303">(Oct 03 2020 at 19:00)</a>:</h4>
<p>you can</p>



<a name="212185306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185306">(Oct 03 2020 at 19:00)</a>:</h4>
<p>I wrote a library to do that actually</p>



<a name="212185330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185330">(Oct 03 2020 at 19:01)</a>:</h4>
<p><a href="https://crates.io/crates/extracterr">https://crates.io/crates/extracterr</a></p>



<a name="212185352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185352">(Oct 03 2020 at 19:02)</a>:</h4>
<p><span class="user-mention" data-user-id="119651">@Dan Johnson</span> thats because anyhow doesn't let you customize he report format</p>



<a name="212185380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185380">(Oct 03 2020 at 19:02)</a>:</h4>
<p>which is why I forked it and wrote eyre</p>



<a name="212185382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185382">(Oct 03 2020 at 19:02)</a>:</h4>
<p>which is anyhow but with custom report formats and context</p>



<a name="212185389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185389">(Oct 03 2020 at 19:02)</a>:</h4>
<p>so for example color-eyre will look for entries that have a backtrace-rs backtrace and skip printing those</p>



<a name="212185396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185396">(Oct 03 2020 at 19:03)</a>:</h4>
<p>and print that backtrace instead of capturing it's own</p>



<a name="212185399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185399">(Oct 03 2020 at 19:03)</a>:</h4>
<p>and it works on stable</p>



<a name="212185405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185405">(Oct 03 2020 at 19:03)</a>:</h4>
<p>this is also how tracing-error works</p>



<a name="212185663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185663">(Oct 03 2020 at 19:10)</a>:</h4>
<p>but the pr to add that feature to anyhow is already open</p>



<a name="212185670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212185670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212185670">(Oct 03 2020 at 19:10)</a>:</h4>
<p>were just making sure we're sure the approach in eyre is fully baked before we put it in anyhow</p>



<a name="212188588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212188588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212188588">(Oct 03 2020 at 20:32)</a>:</h4>
<p>If you stick with thiserror, simply implementing serde::Serialize could give you the means to make your errors into jsons easily. You'd store the actual kvs as values in the error enum variants or structs.</p>



<a name="212188818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212188818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212188818">(Oct 03 2020 at 20:38)</a>:</h4>
<p>FWIW adding context with thiserror types is usually not that much more difficult than with anyhow, instead of <code>with_context(strings live here)</code> you use <code>map_err(Error::Variant)</code>.</p>



<a name="212189633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212189633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leonora Tindall <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212189633">(Oct 03 2020 at 20:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123586">nagisa</span> <a href="#narrow/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors/near/212188818">said</a>:</p>
<blockquote>
<p>FWIW adding context with thiserror types is usually not that much more difficult than with anyhow, instead of <code>with_context(strings live here)</code> you use <code>map_err(Error::Variant)</code>.</p>
</blockquote>
<p>Yes, this is what we do for those cases where we have two <code>thiserror</code> types, using the <code>#[source]</code> attribute. But we don't usually want to define error types unless we see a similar message or error condition being reported in three or more places, as we generally don't know enough about the error condition to abstract it into something useful, in general.</p>



<a name="212189721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212189721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Leonora Tindall <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212189721">(Oct 03 2020 at 21:00)</a>:</h4>
<p>To me, this feels like a kind of symmetry; <code>thiserror</code> gives us both simple enums without fields on the variants, which are mirrored by <code>anyhow</code>, and enum variants with fields, which currently have no equivalent in <code>anyhow</code>.</p>



<a name="212192565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212192565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212192565">(Oct 03 2020 at 22:21)</a>:</h4>
<p>I actively strive to make sure that my error variants are reused as few times as possible. Among other things it also gives me an ability to tell from the error message exactly what part of the codebase the error comes from. Trying to reuse variants goes directly to prevent that from happening. I did describe this somewhat <a href="https://kazlauskas.me/entries/errors.html">here</a>.</p>



<a name="212192634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212192634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212192634">(Oct 03 2020 at 22:23)</a>:</h4>
<p>but yeah I don't believe anyhow gives you a way to express what you want. I could see how it could be able to, but it seems sufficiently specific to a usecase like yours that it would make sense to make it a different crate entirely.</p>



<a name="212214634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212214634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> teor <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212214634">(Oct 04 2020 at 09:24)</a>:</h4>
<p>It looks like the error API you want has a similar shape to the tracing logging macros. They let you attach arbitrary context and spans to log messages.</p>
<p>(This isn't a recommendation to use them in your project, tracing's logging doesn't really interact with error handling.)</p>



<a name="212365829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212365829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212365829">(Oct 05 2020 at 22:47)</a>:</h4>
<p>Will someone assign me to nicer assert messages? Thanks</p>



<a name="212366629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212366629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212366629">(Oct 05 2020 at 22:59)</a>:</h4>
<p><span class="user-mention" data-user-id="344328">@Charles Ellis O'Riley Jr.</span> you might be able to use <code>@rustbot claim</code></p>



<a name="212366767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212366767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212366767">(Oct 05 2020 at 23:00)</a>:</h4>
<p>well we still want i tto bemarked on who's working on what <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="212366781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212366781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212366781">(Oct 05 2020 at 23:00)</a>:</h4>
<p>I'll mark it down Charles</p>



<a name="212366815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212366815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Ellis O&#x27;Riley Jr. <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212366815">(Oct 05 2020 at 23:01)</a>:</h4>
<p><span class="user-mention" data-user-id="220273">@Jane Lusby</span> Thanks</p>



<a name="212366821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/Structured%20Logging%20and%20One-Off%20Errors/near/212366821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/Structured.20Logging.20and.20One-Off.20Errors.html#212366821">(Oct 05 2020 at 23:01)</a>:</h4>
<p>np, and done :D</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>